<?php
require_once 'connexion (2).php';
//require_once 'fonction.php';
require_once 'telech.php';
?>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title></title>
        <link rel="stylesheet" href="feuilledestyle.css">
        <link rel="stylesheet" href="menuHead/jquery.cleditor.css">
        <link href="menu2/styles.css" rel="stylesheet" type="text/css">
        <link rel="stylesheet" type="text/css" href="edittexte/CLEditor1_3_0/jquery.cleditor.css" />
 <!--<script type="text/javascript" src="h ttp://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>-->
 <script type="text/javascript" src="edittexte/CLEditor1_3_0/jquery.cleditor.min.js"></script>
   
 <script type="text/javascript">      
$(document).ready(function() {  $("#ajcom").cleditor();  });  
</script>
    </head>
    <body vlink="blue">
        <div id="page">
        <?php include 'header.php';?>
        <div id="cadre">
            <?php include 'menu.php';
         ?>
            <FORM style="float:left; margin-top: 20px; background-color: orange; "> <INPUT TYPE="button" VALUE="Retour" onClick="history.back()"> </FORM> 
            <div class="centre">
                
                <h3>Compte rendu du stage</h3>
                <?php
                if(!(isset($_GET["id"])))
                {
                    die("Parametre 'id' absent");
                }
                else
                {
                   $id1=$_GET["id"];
		}
               /* */
                creerCP($id1);
                $telCR=tel($id1);
                //echo  $telCR;
                
                $req_c="select * from personne as p, stage as s, eleve as e where p.IDPERSONNE=e.IDELEVE AND e.IDELEVE=s.IDELEVE AND IDSTAGE=".$id1;
                $resu_cr=$connexion->query($req_c);
                if ($rep1=$resu_cr->fetch(PDO::FETCH_ASSOC))
                {

                    $ids=$rep1["IDSTAGE"];
                    $nomS=$rep1["NOMPERSONNE"];
                    $preS=$rep1["PRENOMPERSONNE"];
                    $sujetS=$rep1["SUJETSTAGE"];
                    $dateDS=$rep1["DATEDEBUT"];
                    $dateFS=$rep1["DATEFIN"];
                    echo '<table border="0"  class="petitformdata"  align="center">
                        <tr>
                            <th>Nom : </th>
                            <td>'.$nomS.'</td>
                        </tr>
                        <tr>
                            <th>Prénom : </th>
                            <td>'.$preS.'</td>
                        </tr>
                        <tr>
                            <th>Classe : </th>
                            <td>1 tssio</td>
                        </tr>
                        <tr>
                            <th>Période début stage : </th>
                            <td>'.mDate($dateDS).'</td>
                        </tr>
                        <tr>
                            <th>Période fin stage : </th>
                            <td>'.mDate($dateFS).'</td>
                        </tr>
                        <tr style="float:left; color: slategray; ">
                            <th>Sujet : </th>
                            <td border="1" ><h4 >'.$sujetS.'</h4></td>
                        </tr>
                    </table>
                    
                    <table border="0"  class="petitformdata"  align="center">
                        <tr>
                            <td><a href="'.$telCR.'" target=_block>Télécharger le compte rendu en doc</a></td>
                        </tr>
                    </table><br>
                            ';
                    
                    //<textarea id="sujet" style="color: slategray; " rows="" cols="50" reamdonly>'.$sujetS.'</textarea>
                    
                }
            
                ?>
                 </div>
                <div class="centre">
                    <table border="0"   class="petitformcom"  align="center">
                        <tr style="float:left;">
                            <td>
                                <?php
                                $req_ac="select * from compterendu where IDSTAGE=".$id1." order by DATESAISIE desc";
                                $resu_a=$connexion->query($req_ac);
                                while ($repac=$resu_a->fetch(PDO::FETCH_ASSOC))
                                {
                                    $idC=$repac['NUMCOMPTER']; ?>
                                    <table  border='0' style='font-size:70%;'><tr class='petitformcom' ><td> <?php echo "le ".mDate($repac['DATESAISIE'])."&nbsp;&nbsp;";?> <a href="commenter.php?action=delete&ids=<?php echo $idC; ?>" onclick="return(confirm('êtes-vous sure de vouloir supprimer le commentaire ?'));" style="float:right;">Supp</a><br>
                                          <h5  style='float:left;'><?php echo $repac['CORPS'];?></h5><br><br></td></tr></table>
                              <?php  }
                                
                               
                                ?>
                            </td>
                           
                            </tr>
                            <tr style="float:left;">
                            <td>
                                <br>
                            <center>
                                <i><form enctype="multipart/form-data" action="commenter.php?ids=<?php echo $ids;?>&auteur=<?php echo $_SESSION['mail']; ?>&action=inserer" method="POST"/>
                                       
                                    <textarea class="tabjcom" name="ajcom" id="ajcom" cols="55" rows="4" placeholder="Ajouter un commentaire..." maxlength="500"></textarea>
                                    &nbsp;&nbsp;<input type='submit' name='commente' value='Poster' align='right'/>
                                    &nbsp;&nbsp;&nbsp;::..::&nbsp;&nbsp;&nbsp;<input type='reset' name='rescom' value='Annuler' align='right'/>
                                </form></i>
                            </center>
                            </td>
                        </tr>
                    </table><br><br>
                </div>
            <FORM style="float:left; margin-top: -20px; background-color: orange; "> <INPUT TYPE="button" VALUE="Retour" onClick="history.back()"> </FORM> 
            <?php require_once 'pied.php';?>
        </div>
        </div>
    </body>
</html>